package com.cqhilink.api.common.utils;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;


/**
 * 获取Cookie的参数值
 *
 * @author 王镇
 * @create 2017-02-27 14:53
 */
public class CookieUtil {
    public static String getCookieValue(HttpServletRequest request, String name) {
        String value = "";
        Cookie[] cookies = request.getCookies();
        if (cookies != null) {
            for (Cookie cookie : cookies) {
                if (cookie.getName().equalsIgnoreCase(name)) {
                    value = cookie.getValue();
                }
            }
        }
        return value;
    }
}
